﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Inaction.Core;
using Inaction.Mapping;
using Inaction.Business.Security.Rules;
using Inaction.Security;
using Inaction.Rule;

namespace Inaction.Business.Security.Abstract
{
    [Table("AssemblyClass"), DisplayName("程序集类"), Serializable]
    public abstract class AssemblyClass<T> : Inaction.Business.Entity<T> where T : AssemblyClass<T>, new()
    {
        #region 属性

        public static readonly Property<Guid?> IdProperty = RegisteProperty<Guid?>(p => p.Id);
        Guid? _id;
        [Column("Id"), DisplayName("程序集类"), Display(Description = "程序集类")]
        public Guid? Id
        {
            get { return _id; }
            internal set { SetProperty(IdProperty, ref _id, value); }
        }

        public static readonly Property<String> NameProperty = RegisteProperty<String>(p => p.Name);
        String _name;
        [Column("Name"), DisplayName("名称"), Display(Description = "名称")]
        public String Name
        {
            get { return _name; }
            set { SetProperty(NameProperty, ref _name, value); }
        }

        public static readonly Property<String> DescriptionProperty = RegisteProperty<String>(p => p.Description);
        String _description;
        [Column("Description"), DisplayName("说明"), Display(Description = "说明")]
        public String Description
        {
            get { return _description; }
            set { SetProperty(DescriptionProperty, ref _description, value); }
        }

        public static readonly Property<Guid?> AssemblyIdProperty = RegisteProperty<Guid?>(p => p.AssemblyId);
        Guid? _assemblyId;
        [Column("AssemblyId"), DisplayName("程序集"), Display(Description = "程序集")]
        public Guid? AssemblyId
        {
            get { return _assemblyId; }
            set { SetProperty(AssemblyIdProperty, ref _assemblyId, value); }
        }

        public static readonly Property<ClassType?> ClassTypeProperty = RegisteProperty<ClassType?>(p => p.ClassType);
        ClassType? _classType;
        [Column("ClassType"), DisplayName("类型"), Display(Description = "类型")]
        public ClassType? ClassType
        {
            get { return _classType; }
            set { SetProperty(ClassTypeProperty, ref _classType, value); }
        }

        public static readonly Property<Boolean?> EnableCachedProperty = RegisteProperty<Boolean?>(p => p.EnableCached);
        Boolean? _enableCached;
        [Column("EnableCached"), DisplayName("是否启用缓存"), Display(Description = "是否启用缓存")]
        public Boolean? EnableCached
        {
            get { return _enableCached; }
            set { SetProperty(EnableCachedProperty, ref _enableCached, value); }
        }

        public static readonly Property<ChangeLogType?> ChangeLogTypeProperty = RegisteProperty<ChangeLogType?>(p => p.ChangeLogType);
        ChangeLogType? _changeLogType;
        [Column("ChangeLogType"), DisplayName("日志变更类型"), Display(Description = "日志变更类型")]
        public ChangeLogType? ChangeLogType
        {
            get { return _changeLogType; }
            set { SetProperty(ChangeLogTypeProperty, ref _changeLogType, value); }
        }


        public static readonly Property<String> CreaterProperty = RegisteProperty<String>(p => p.Creater);
        String _creater;
        [Column("Creater"), DisplayName("创建人"), Display(Description = "创建人"), Browsable(false)]
        public String Creater
        {
            get { return _creater; }
        }

        public static readonly Property<DateTime?> CreateTimeProperty = RegisteProperty<DateTime?>(p => p.CreateTime);
        DateTime? _createTime;
        [Column("CreateTime"), DisplayName("创建时间"), Display(Description = "创建时间"), Browsable(false)]
        public DateTime? CreateTime
        {
            get { return _createTime; }
        }

        public static readonly Property<String> UpdaterProperty = RegisteProperty<String>(p => p.Updater);
        String _updater;
        [Column("Updater"), DisplayName("修改人"), Display(Description = "修改人"), Browsable(false)]
        public String Updater
        {
            get { return _updater; }
        }

        public static readonly Property<DateTime?> UpdateTimeProperty = RegisteProperty<DateTime?>(p => p.UpdateTime);
        DateTime? _updateTime;
        [Column("UpdateTime"), DisplayName("修改时间"), Display(Description = "修改时间"), Browsable(false)]
        public DateTime? UpdateTime
        {
            get { return _updateTime; }
        }

        #endregion
    }
}
